package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/showAddEmp")
public class ShowAddEmpServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 指定响应编码
        resp.setCharacterEncoding("utf-8");
        PrintWriter out = resp.getWriter();
        out.println("<!DOCTYPE html>");
        out.println("<html lang=\"en\">");
        out.println("<head>");
        out.println("    <meta charset=\"UTF-8\">");
        out.println("    <title>添加员工</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>添加员工</h1>");
        out.println("<a href=\"findAll\">返回员工列表</a>");
        out.println("<hr>");
        out.println("<form action=\"addEmp\" method=\"post\">");
        out.println("    姓名:<input type=\"text\" name=\"name\"><br>");
        out.println("    工资:<input type=\"text\" name=\"salary\"><br>");
        out.println("    性别:");
        out.println("    <input type=\"radio\" name=\"gender\" value=\"man\">男");
        out.println("    <input type=\"radio\" name=\"gender\" value=\"woman\">女<br>");
        out.println("    学历:");
        out.println("    <select name=\"edu\">");
        out.println("        <option value=\"-1\">请选择</option>");
        out.println("        <option value=\"1\">大专</option>");
        out.println("        <option value=\"2\">本科</option>");
        out.println("        <option value=\"3\">研究生</option>");
        out.println("    </select><br>");
        out.println("    兴趣:");
        out.println("    <input type=\"checkbox\" name=\"hobbies\" value=\"eat\">吃饭");
        out.println("    <input type=\"checkbox\" name=\"hobbies\" value=\"sleep\">睡觉");
        out.println("    <input type=\"checkbox\" name=\"hobbies\" value=\"beat\">打豆豆<br>");
        out.println("    <input type=\"submit\" value=\"添加\">");
        out.println("</form>");
        out.println("</body>");
        out.println("</html>");
    }
}
